package com.wy.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.wy.ssm.domain.Product;
import com.wy.ssm.mapper.ProductMapper;
import com.wy.ssm.service.ProductService;
import com.wy.ssm.utils.Uuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: wy
 * @Date:2019/9/4 15:12
 */
@Service
public class ProductServiceImpl implements ProductService {
      @Autowired
          private ProductMapper productMapper;


    @Override
    public List<Product> findAll(Integer pageNum,Integer pageSize,String username) throws Exception{
        //分页插件
        PageHelper.startPage(pageNum,pageSize);
         return productMapper.findAll(username);

    }

    @Override
    public void save(Product product) throws Exception {
          product.setId(Uuid.getUuid());
       productMapper.save(product);
    }
}
